package com.chushouya.order.constants;



import com.general.framework.core.enums.IEnum;
import com.general.framework.core.lang.Strings;

import java.util.Objects;

public enum AlipayEnergyGoodsTypeEnum implements IEnum<Long> {
    CEllPHONE(100001L, "cellphone"),
    CAMERA(100003L, "camera"),
    PAD(100002L, "laptop"),
    LAPTOP(100004L, "laptop"),
    COMPUTER(100005L, "laptop");


    private Long value;

    private String desc;

    AlipayEnergyGoodsTypeEnum(Long value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static String getDesc(Long status) {
        for (AlipayEnergyGoodsTypeEnum thisEnum : AlipayEnergyGoodsTypeEnum.values()) {
            if (Objects.equals(thisEnum.value, status)) {
                return thisEnum.desc;
            }
        }
        return Strings.EMPTY;
    }
    public Long getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }
    /**
     * 通过value取枚举
     * @param value
     * @return
     */
    public static AlipayEnergyGoodsTypeEnum getTypeByValue(Long value){
                for (AlipayEnergyGoodsTypeEnum enums : AlipayEnergyGoodsTypeEnum.values()) {
            if (enums.getValue() == value) {
                return enums;
            }
        }
        return null;
    }
    @Override
    public Long value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }
}
